<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>胶囊选项</title>
    <link rel="stylesheet" href="../css/bootstrap.css">
    <script src="../js/jq-1.12.4.js"></script>
    <script src="../js/bootstrap.js"></script>
</head>

<body>
    <div id="app" class='container'>
        <h3>胶囊选项卡nav-pills</h3>
        <ul class="nav  nav-pills">
            <li class="active"><a href="#">首页</a></li>
            <li><a href="#">搜索</a></li>
            <li><a href="#">热点</a></li>
            <li><a href="#">美女</a></li>
            <li><a href="#">军事</a></li>
        </ul>
        <div>
            首页
        </div>
    </div>
</body>
<script>
    $(".nav li").click(function () {
        //修改激活状态
        $(this).siblings().removeClass("active").end().addClass("active")
        //在div中显示点击的内容
        $(this).parent().next().html($(this).html())
    })
</script>

</html>